package com.nine.algorithm.linklist;

import org.junit.jupiter.api.Test;

/**
 * @author nine
 * @version 1.0
 * @description TODO
 * @date 24/4/26 21:19
 */
public class TestSinglyLinkedList {

	@Test
	public void test1() {
		SinglyLinkedList list = new SinglyLinkedList();
		list.addFirst(1);
		list.addFirst(2);
		list.addFirst(3);
		list.addFirst(4);

		list.loop(value->{
			System.out.print(value + ",");
		});

		System.out.println();

		list.loop2(value->{
			System.out.print(value + ",");
		});
	}

	@Test
	public void test2() {
		SinglyLinkedList list = new SinglyLinkedList();
		list.addLast(1);
		list.addLast(2);
		list.addLast(3);
		list.addLast(4);

		list.loop(value->{
			System.out.print(value + ",");
		});

		System.out.println();

		list.loop2(value->{
			System.out.print(value + ",");
		});
	}
	
	@Test
	public void test3(){
		SinglyLinkedList list = new SinglyLinkedList();
		list.addLast(1);
		list.addLast(2);
		list.addLast(3);
		list.addLast(4);

		int i = list.get(3);
		System.out.println(i);

		int res = list.get(10);
		System.out.println(res);
	}
}
